//
// @Author: Zhenwei Xiao
// @Description:
// @Version: 1.0.0
// @Date: 2021/4/7 下午3:00
// @Copyright: MIN-Group；国家重大科技基础设施——未来网络北大实验室；深圳市信息论与未来网络重点实验室
//
const stream_transport = require("./StreamTransport")

class TcpTransport extends stream_transport.StreamTransport{
    constructor(st) {
        super(st)
        // this.StreamTransport = new stream_transport.StreamTransport()
    }

    //
    // @Description:  初始化TcpTransport
    // @receiver t
    // @param conn net.Conn
    //
    Init(conn) {
        this.conn = conn
        // Q：怎么获取本地地址,直接赋值？
        this.localAddr = "127.0.0.1"
        this.localUri = "tcp://" + this.localAddr
        this.remoteAddr = conn[0].hostTo
        this.remoteUri = "tcp://" + this.remoteAddr
        this.recvBuf = new Buffer.alloc(1024*1028*4)
        this.recvLen = 0
    }
}

module.exports = {
    TcpTransport: TcpTransport
}


